package com.sunlands.zlcx.usercenter.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author shixiaopeng
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity(name = "tz_vip_user_set_meal_record")
@DynamicUpdate
@DynamicInsert
public class VipUserSetMealRecordDO implements Serializable {

    private static final long serialVersionUID = -5222975848079627189L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 用户表tz_user的id
     */
    private Long userId;

    /**
     * 购买的卡id，月卡/季卡/年卡
     */
    private Long setMealId;

    /**
     * 操作类型，1购买，2退费
     */
    private Integer operateType;

    /**
     * 订单号
     */
    private String orderNo;

    /**
     * 商品类型
     */
    private Integer type;

    @ApiModelProperty(value ="创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(insertable = false, updatable = false)
    Date createTime;

    public enum OperateEnums{
        BUY(1, "开通/续费"),
        REFUND(2, "退费");

        public final Integer code;
        public final String desc;
        OperateEnums(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }
    }
}
